<?php
namespace app\Controller;


use app\Model\Article;
use core\Parser;

class IndexController extends BasicController
{
    public function index($id = 1)
    {

        $article = (new Article())->where(['status'=>0])->select();
        $this->assign('article',$article);
        $this->display('index',['page'=>$id]);
    }

    public function article($id){
        $parser = new Parser();
        $article = (new Article())->where(['id'=>$id])->find();
        $article['content'] = $parser->makeHtml($article['content']);
        $this->assign('article',$article);
        $this->display('article',['article'=>$id]);
    }
}